<extend name="Public/common"/>
<block name="content">
<div class="page_content_offset">
	<div class="container">
		<div class="row clearfix">
			<section class="col-lg-9 col-md-9 col-sm-9">
				<h2 class="tt_uppercase color_dark m_bottom_25">用户登录</h2>
					<div class="m_bottom_20">
						<!--login form-->
						<form method="post" name="validator-form" action="<{:U('member/login')}>" class="form-horizontal">
							<ul>
								<li class="clearfix m_bottom_15">
									<div class=" type_2 f_left col-lg-4 col-md-6 col-sm-12">
										<label class="m_bottom_5 d_inline_b " for="username">用户名</label>
										<input type="text" class="r_corners full_width m_bottom_5 " name="username" id="username">
										
									</div>
								</li>
								<li class="clearfix m_bottom_15">
									<div class="type_2 f_left col-lg-4 col-md-6 col-sm-12">
										<label class="m_bottom_5 d_inline_b" for="pass">密码</label>
										<input type="password" class="r_corners full_width m_bottom_5" name="password" id="pass">										
									</div>
								</li>
								
								<if condition="C('VERIFY_OFF') eq '1' ">
								<li class="m_bottom_15">
									<label  class="m_bottom_5 d_inline_b">验证码</label><br>
									<input type="text" name="verify"  class="r_corners full_width">
								</li>
													
								<li class="m_bottom_15">                  		
			                    	<img class="verifyimg reloadverify" width="100%" alt="点击切换" src="<{:U('Member/verify')}>" style="cursor:pointer;">              		
			                	</li>
			                	<script type="text/javascript">
								$(function(){
									var verifyimg = $(".verifyimg").attr("src");
						            $(".reloadverify").click(function(){
						                if( verifyimg.indexOf('?')>0){
						                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
						                }else{
						                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
						                }
						            });
								});
								</script>
								</if>
								<li class="m_bottom_15">
									<input type="checkbox" id="checkbox_4" name="checkbox_4" class="d_none"><label for="checkbox_4">记住我</label>
									<span><a class="color_dark f_size_medium m_left_10" href="#">忘记用户名?</a></span>
									<span><a class="color_dark f_size_medium m_left_10" href="#">忘记密码?</a></span>
								</li>
								<li><button class="button_type_4 r_corners bg_scheme_color color_light login_btn tr_all_hover">登录</button></li>
							</ul>
						</form>
					</div>
				
			</section>
			<aside class="col-lg-3 col-md-3 col-sm-3">
				<figure class="widget shadow r_corners wrapper m_bottom_30">
					<figcaption>
						<h3 class="color_light">还可以用以下方式登录</h3>
					</figcaption>
					<div class="widget_content">
						暂时未整合
					</div>
				</figure>
			</aside>
		</div>
	</div>
</div>
</block>
<block name="player"><include file="Player/default"/></block> 
<block name="script">
	<script type="text/javascript">
    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").addClass("log-in").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").removeClass("log-in").attr("disabled", false);
	    	});

    	$("form").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"), self.serialize(), success, "json");
    		return false;

    		function success(data){
    			if(data.status){
    				if(data.url){
    					infoAlert(data.info + ' 页面即将自动跳转~',true);
	                   	setTimeout(function(){
	                        if (data.url) {
	                            location.href=data.url;
	                        }
	                    },1500);
                	}else{
                		infoAlert(data.info,true);
                	}
    			} else {
    				infoAlert(data.info);
    				//刷新验证码
    				//$(".reloadverify").click();
    			}
    		}
    	});

		$(function(){
			var verifyimg = $(".verifyimg").attr("src");
            $(".reloadverify").click(function(){
                if( verifyimg.indexOf('?')>0){
                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
                }else{
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
                }
            });
		});
	</script>
</block>